<?php
class UCCASS_Urlcat extends UCCASS_Main
{
       
    /**************
    * CONSTRUCTOR *
    **************/
    function UCCASS_Urlcat()
    { $this->load_configuration(); }
    
    function listar($a_id,$type){
    	
        /*$sql = "SELECT cid, category 
                FROM {$this->CONF['db_tbl_prefix']}category
                WHERE active=1";*/
        if($type == 2){
        	 $sql = "SELECT c.cid, c.category 
                FROM {$this->CONF['db_tbl_prefix']}category c, {$this->CONF['db_tbl_prefix']}admin_type_category a
                WHERE a.a_id=$a_id AND a.cid=c.cid";
        }elseif($type == 1){
              $sql = "SELECT cid, category 
                FROM {$this->CONF['db_tbl_prefix']}category";
        }      
        
		$rs = $this->db->Execute($sql);
		
	    $x=0;
	   	while($r = $rs->FetchRow($rs)){
    		$resuls[$x]["cid"]= $r["cid"];
    		$resuls[$x]["category"]= $r["category"];
    		$x++;
    	}
    	
    //	$this->smarty->assign('mostrar','categ');
    	$this->smarty->assign('url',$this->CONF["html"]);	
		$this->smarty->assign('resultados',$resuls);
      

        return $this->smarty->fetch($this->template.'/urlcat.tpl');
    	
    }
    
   
    
}
 
?>